<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>spriteJS-3D</title>
  <style>
    html,body{
      width: 100%;
      height: 100%;
      margin: 0;
    }
    #container{
      height: 100%;
    }
  </style>
</head>

<body>
  <div id="container"></div>
</body>
<script src="./js/spritejs.js"></script>
<script src="./js/sprite-extend-3d.js"></script>
<script>
  const { Scene } = spritejs;
  const { Cube, shaders } = spritejs.ext3d;

  const container = document.getElementById('container');
  const scene = new Scene({ container });
  const layer = scene.layer3d('fglayer', {
    camera: {
      fov: 35, // Field of view
    },
  });
  layer.camera.attributes.pos = [3, 3, 5];

  const program = layer.createProgram({
    ...shaders.NORMAL_GEOMETRY,
    cullFace: null,
  });

  const cube = new Cube(program, {
    colors: 'red red blue blue green green',
  });
  layer.append(cube);

  layer.setOrbit(); // 开启旋转控制
</script>

</html>